package com.rsk.dao;


import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.rsk.entity.SysRole;


@Repository
public interface SysRoleRepository extends JpaRepository<SysRole, Long>,JpaSpecificationExecutor<SysRole>,Serializable {

	@Modifying
	@Query(value = "update sys_roles set role_name = ?2, role_code = ?3, operator_user =?4, operator_time = NOW() where id =?1", nativeQuery = true)
	public int updateSysRole(Long id, String roleName, String roleCode, Long operatorUser);
	
	@Modifying
	@Query(value = "update sys_roles set is_del = 1, operator_user =?2, operator_time = NOW() where id =?1", nativeQuery = true)
	public int delSysRole(Long id, Long operatorUser);


	@Query(value = "select id ,menu_name,menu_url,p_id,sort from sys_menus where is_del = 0 Order by sort", nativeQuery = true)
	public List<Map> selectSysRole(Long id,String menuName,String menuUrl,Long pId,Integer sort);
	
}
 